home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 203_01 / yamimpl.doc < prev    next >
Encoding:
Text File  |  1980-01-01  |  10.8 KB  |  304 lines

  1.                            Implementation Manual for
  2.                             YAM (Yet Another Modem)
  3.                                by Chuck Forsberg
  4.  
  5.                      (Converted for MS-DOS and Lattice-C)
  6.                                 by Olen Pederson
  7.  
  8.  
  9. 1. FILE TRANSFER PROTOCOL
  10.  
  11.     The transmission of pathnames in batch mode differs from that 
  12.     used in MODEM7.  Yam sends the pathname as a null terminated 
  13.     string in a standard Ward Christensen type packet with a 
  14.     sector number of 0.
  15.  
  16.     The sender may append the following additional information 
  17.     starting one byte after the null that terminates the 
  18.     pathname:
  19.  
  20.     sprintf(p, "%lu %lo %o", f.stsize, f.stmtime, f.stmode);
  21.  
  22.     where stsize is the exact length of the file in bytes,  
  23.     stmtime is the modification date in seconds since 1970, and  
  24.     stmode is the file mode, as defined for Unix V7/Sys3.  If  
  25.     the mod time is unavailable, a 0 value will cause the  
  26.     receiver to ignore it.  If the file mode is unavailable, a 
  27.     0  value will cause the receiver to ignore it and use a 
  28.     default  file mode.
  29.  
  30.     Disk specifiers (B:) are not sent.  Directory names of full 
  31.     pathnames are not (generally) sent.  If this information 
  32.     (including the trailing null provided by sprintf) exceeds 
  33.     the 128 byte standard sector length, a long sector must be 
  34.     sent.
  35.  
  36.     The sender waits for an initial NAK before sending the  
  37.     pathname.  An explicit NAK is sent by the receiver at  
  38.     intervals when is ready to receive a pathname.  Upon  
  39.     receiving and acknowledging the pathname packet, the 
  40.     receiver opens the file and then sends the initial NAK for 
  41.     the data in the file.  A null pathname terminates batch 
  42.     transmission.
  43.  
  44.     The remainder of the pathname sector is set to nulls.
  45.  
  46.  
  47. 2. YAM IMPLEMENTATION
  48.  
  49.     Yam consists of the files:
  50.         yam.h        header and globals
  51.         yamsys.h    installation specific data
  52.         yam1.c        First time initialization
  53.                 Main command decoding
  54.         yam2.c        Christensen protocol handler
  55.         yam3.c        Conversation with data capture
  56.                 File xmsn w/o error checking.
  57.         yam4.c        CIS A Protocol handler (see MYSYSYTEM )
  58.         yam5.c        Misc modem related functions, such as 
  59.                 baudrate
  60.                 user specific modem init, etc.
  61.         yam7.c        Disk i/o open,close, directory
  62.                 Wild card expansion, O/S related stuff
  63.         yam8.asm    CRCK calculation routine.
  64.         yam9.asm    CRC calculation routine.
  65.         yam10.c        USQ and some time critical functions
  66.         yam11.asm    MS-DOS assembly language interface
  67.         yamcfg.t    default start up config file
  68.         yamphone.t    phone list
  69.         yamhelp.t    help file
  70.  
  71.     Yam utilizes a circular buffer for file receive.  Characters 
  72.     are placed into this buffer by the modem input routine.  
  73.     This routine places data at bufcq.  Data is removed from the 
  74.     buffer by using another pointer, bufcdq(console) or 
  75.     bufpdcq(printer). This method allows the buffer to be filled 
  76.     faster than it is emptied, as long as it eventually gets a 
  77.     chance to empty out.
  78.  
  79.     Design goals: A general program performing the functions of 
  80.     MODEM and XMODEM, easily portable to non-timesharing 
  81.     computer systems. YAM facilitates communications and s/w 
  82.     exchange via timesharing, RCP/M, and Bulletin Board systems. 
  83.     Coding style is/was aimed at portability and clarity. File 
  84.     transfer routines are written without timing assumptions 
  85.     allowing error free high speed operation even if view 
  86.     selected
  87.  
  88.     The MS-DOS implementation of YAM is for the IBM pc and its 
  89.     lookalikes.  Because of the slow screen output functions of 
  90.     the IBM-PC, the modem input routine was written as an 
  91.     interrupt procedure.  This has the added advantage of 
  92.     allowing transfers of data at high baud rates without 
  93.     loosing characters.  The IBM version has been tested at 9600 
  94.     baud with no loss of data.
  95.  
  96.     If your machine uses a different type of UART chip, or a 
  97.     built-in modem card, then the yamsys.h, yam11.asm and 
  98.     yam5.c  files will need work.
  99.  
  100.     Special effort was made to not use any of the cute calls for 
  101.     special graphics capability of the IBM pc.  This results in 
  102.     a no-nonsense but terse program which can easily be modified 
  103.     to run on ANY MS-DOS compatible machine.
  104.  
  105.     There are versions of Yam available for the Z89 (with aux 
  106.     board), Cromemco TUART, TRS-80 II, and Apple (currently with 
  107.     Z19 console).
  108.  
  109.     There will be multiple versions of yam5.c depending on the 
  110.     target system.  The file yam7.c will vary between different 
  111.     operating systems.  Most of the rest of the files should 
  112.     remain fairly constant.
  113.  
  114.     Compilation and proper operation of this version of YAM is 
  115.     based on version 2.15e of the Lattice 'C' compiler and 
  116.     version 2.1 of MS-DOS.  Other versions of YAM may be 
  117.     available from the BDS C Users Group.
  118.  
  119.  
  120. 3. PROPAGATING YAM
  121.  
  122.     Often the question arises, "How do I get YAM (or whatever) 
  123.     into this neat new machine with the *%!@$@ format disks?
  124.  
  125.     One possibility would be to convert the yam-target.com image 
  126.     into a hex file.  Then run copy on the target machine with 
  127.     input from the serial port    and output to a file.
  128.  
  129.     Once you have a working yam running on target machine, other  
  130.     files come across effortlessly with the batch file transfer  
  131.     option.
  132.  
  133.  
  134. 4. IMPORTANT #define's
  135.  
  136.     CDO
  137.         Define a test for carrier drop out so that XYAM will 
  138.         automatically exit T(erm) function when the 
  139.         connection is broken.
  140.  
  141.     CICHAR  Unadorned unconditional console input.  This must  
  142.         not trap on any control characters needed for host   
  143.         communications.
  144.  
  145.     CONOUT(c)
  146.         Unadorned output of c to the local display.  YAM  
  147.         checks that the local display is ready before  
  148.         executing CONOUT(c).  CONOUT(c) must return  
  149.         immediately regardless of what is in c.
  150.  
  151.     HELPFILE
  152.         This defines the file name (usually YAMHELP.T:") 
  153.         which contains a short summary of commands and 
  154.         other  useful information to jog your memory when 
  155.         you forget a command.
  156.  
  157.     IBMPC
  158.         If defined, will pull in some IBM-PC specific 
  159.         routines.
  160.  
  161.     IOTYPE
  162.         This defaults to char for i/o mapped systems with  
  163.         256 ports.  This may be defined to unsigned or long  
  164.         for systems with more ports (8086 or memory mapped 
  165.         i/o).
  166.  
  167.     KBDBRK
  168.         This defines the keyboard character that translates 
  169.         to a break in yam3.  It should not be a normally 
  170.         used character.  Found in yam3.c.
  171.  
  172.     LOGRX
  173.         Log all files received from remote systems in the 
  174.         file LOGRX.  Information stored includes user 
  175.         number, disk, filename, baudrate, and the name of 
  176.         the remote system given in the last call command 
  177.         (LASTCALR in xyam).
  178.  
  179.     LOGTX
  180.         Log all files transmitted to remote systems in file 
  181.         LOGTX.  Information same as above.
  182.  
  183.     LOGFILE
  184.         Must be defined if either of the above are.
  185.  
  186.     LPOUT(c)
  187.         Likewise, unadorned output of c to the printer.  
  188.         LPOUT(c) must return immediately regardless of what 
  189.         is in c.
  190.  
  191.     LPREADY
  192.         This define returns non zero if the line printer is 
  193.         ready to accept a character.  It must always return 
  194.         0 if LPOUT(c) would not return immediately.  If 
  195.         POREADY is slow, enabling the printer at high baud 
  196.         rates may cause characters to be lost.
  197.  
  198.     MOCHAR(c)
  199.         This outputs the character c to the modem.  This 
  200.         macro need not check whether the modem is ready for 
  201.         a  character as that has already been done.  
  202.         MODOUT(c) must return immediately regardless of what 
  203.         is in c.
  204.  
  205.     MYSYSTEM
  206.         Defining this causes yam2 to be compiled with a call 
  207.         to yam4.c for handling the Compuserve A protocol for 
  208.         file transfer (see 2 mode).  Unless you know what 
  209.         you are doing, you should use the following even if 
  210.         it is a bloody lie as xftran may not accept 
  211.         something original.  If this is included, you will 
  212.         need yam4.c, otherwise not.
  213.  
  214.         #define MYSYSTEM "#CPMHeath/Zenith,CC,HC,PA,PL\015"
  215.  
  216.     PATHSEP
  217.         This is defined as a string which defines the 
  218.         pathname separators.  This supports those who have 
  219.         inserted the patch for the DOS SWITCHAR by defining 
  220.         the PATHSEP as "\/".
  221.  
  222.     PHONES
  223.         This defines the file (usually "YAMPHONE.T") which 
  224.         contains a list of names, phone numbers, and 
  225.         baudrates. The names must be in lower case.
  226.  
  227.     RESTRICTED
  228.         Certain commands and options are disabled. Existing 
  229.         files cannot be deleted.
  230.  
  231.     RXNONO
  232.         Define this as a string of characters, any of which 
  233.         would cause your terminal and/or cbios grief if not 
  234.         suppressed by term function.
  235.  
  236.     STATLINE
  237.         Define this if your terminal has an extra (viz., 
  238.         25th) line usable for status information which does 
  239.         not scroll up nor interfere with scrolling.  
  240.         lpstat() writes to the entire status line, clearing 
  241.         out any previous contents.  pstat() writes starting 
  242.         at the 48th position, not disturbing any information 
  243.         written by lpstat().  Lpstat and pstat routines will 
  244.         need to be appropriately modified.
  245.  
  246.     TERMINIT
  247.         This string should unconditionally initialize and 
  248.         clear the screen.
  249.  
  250.     USQ
  251.         Allows the type command to automatically recognize 
  252.         squeezed files and display them in ASCII form.  Adds 
  253.         about 4k to program size.
  254.  
  255.     YAMCONFIG
  256.         This defines the file (usually "YAMCONFIG.T") which 
  257.         contains configuration data which YAM will use on 
  258.         startup to configure itself.
  259.  
  260.  
  261. 5.  TUNING PARAMETERS
  262.  
  263.     Yam uses a number of tuneable parameters for portability.  
  264.     The values used depend strongly on the speed of functions 
  265.     and operating system calls used to interrogate the keyboard 
  266.     and modem port.  They are also affected by the clock speed 
  267.     and code quality of the compiler used.  These parameters 
  268.     have been added on a somewhat ad hoc basis, so one should 
  269.     grep the source files to determine the extent of their 
  270.     effects.
  271.  
  272.     CLKMHZ
  273.         This is a ``master'' parameter.  Use it to calibrate 
  274.         the timeout in readchar (see yam5 or equivalent).
  275.  
  276.     LOOPS
  277.         Timing value in sleep.
  278.  
  279.     LOWWATER
  280.         When receiving text from the host in term function, 
  281.         term transmits XOFF (DC3) when the free buffer space 
  282.         gets down to LOWATER.
  283.  
  284.  
  285. 6.  Recent Revisions/Enhancements to YAM
  286.  
  287.     YAM has undergone a nearly complete re-write as of this 
  288.     revision.  Some of the major changes have been the extensive 
  289.     addition of comments and the re-formating of the code so it 
  290.     is all written in a consistent manner.  As the conversion 
  291.     from CPM to MS-DOS progressed it became apparent the 
  292.     conditional compile approach for different operating systems 
  293.     was unwieldy.  As a result, defines for conditional compiles 
  294.     were removed.  Nearly all the modules suffered major changes 
  295.     as the code quality had degraded over the years of several 
  296.     different authors adding features.  Some commands were 
  297.     deleted because they either didn't work or served no useful 
  298.     purpose.   So, here we start again anew.
  299.  
  300. 7.  Wish list
  301.  
  302.     Kermit protocol handler
  303.     Terminal emulation
  304.